const CompressionWebpackPlugin = require('compression-webpack-plugin')
const productionGzipExtensions = ['js', 'css']

module.exports = {
    outputDir: 'dist',
    publicPath: './',
    lintOnSave: true,
    runtimeCompiler: true,
    productionSourceMap: false,

    devServer: {
        port: 8086,
        hotOnly: false,
        proxy: {
            '/gambler': {
                target: 'https://www.gambler.plus/',
                // target: 'http://127.0.0.1:8083/',
                changOrigin: true,
                pathRewrite: {
                    '^/gambler': '/gambler'
                }
            }
        },
        watchOptions: {
            ignored: /node_modules/
        }
    },

    css: {
        loaderOptions: {
            less: {
                modifyVars: {
                    'primary-color': '#4e54c8',//'#6777ef',
                    'input-placeholder-color': '#42526e',
                    'border-radius-base': '2px',
                    'error-color': '#8b0000',
                },
                javascriptEnabled: true,
            },
        },
    },

    configureWebpack: config => {
        config.plugins.push(new CompressionWebpackPlugin({
                algorithm: 'gzip',
                test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
                threshold: 10240,
                minRatio: 0.8
            })
        )
    }
}